Set the filename to NULL for builtin icons, sinc
authorMatthias Clasen <mclasen@redhat.com>
Wed, 25 Apr 2007 18:01:44 +0000 (18:01 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 25 Apr 2007 18:01:44 +0000 (18:01 +0000)
2007-04-25  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkicontheme.c (theme_lookup_icon): Set the filename to
        NULL for builtin icons, sinc gtk_icon_info_get_builtin_pixbuf()
        depends on it.

        * tests/testicontheme.c: Report builtin icons.

svn path=/trunk/; revision=17638

ChangeLog
gtk/gtkicontheme.c
tests/testicontheme.c

index b343ae3c679187d24d6d2cc229e8457312870772..c970be637648681d692fee5cf3f493efc4a68d8e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-04-25  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkicontheme.c (theme_lookup_icon): Set the filename to
+       NULL for builtin icons, sinc gtk_icon_info_get_builtin_pixbuf()
+       depends on it. 
+
+       * tests/testicontheme.c: Report builtin icons.
+
 2007-04-25  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkprintoperation.c (preview_iface_end_preview): Don't 
index 2aaa445dc83ee3cf8a85b2768dcf295ee11f294d..b7db3f4f8c7a50d449a2477e684548b1b04017b7 100644 (file)
@@ -2079,13 +2079,23 @@ theme_lookup_icon (IconTheme          *theme,
       suffix = best_suffix (suffix, allow_svg);
       g_assert (suffix != ICON_SUFFIX_NONE);
       
-      file = g_strconcat (icon_name, string_from_suffix (suffix), NULL);
-      icon_info->filename = g_build_filename (min_dir->dir, file, NULL);
-      g_free (file);
+      if (min_dir->dir)
+        {
+          file = g_strconcat (icon_name, string_from_suffix (suffix), NULL);
+          icon_info->filename = g_build_filename (min_dir->dir, file, NULL);
+          g_free (file);
 #ifdef G_OS_WIN32
-      icon_info->cp_filename = g_locale_from_utf8 (icon_info->filename,
+          icon_info->cp_filename = g_locale_from_utf8 (icon_info->filename,
                                                   -1, NULL, NULL, NULL);
 #endif
+        }
+      else
+        {
+          icon_info->filename = NULL;
+#ifdef G_OS_WIN32
+          icon_info->cp_filename = NULL;
+#endif
+        }
       
       if (min_dir->icon_data != NULL)
        icon_info->data = g_hash_table_lookup (min_dir->icon_data, icon_name);
index c14f4d2d3214eb0f7ab7db128248e9eb926751b3..90d4eaad597994e2c1ec76e7bc1e512f5194a61f 100644 (file)
@@ -128,9 +128,9 @@ main (int argc, char *argv[])
       if (argc >= 5)
        size = atoi (argv[4]);
       
-      icon_info = gtk_icon_theme_lookup_icon (icon_theme, argv[3], size, 0);
+      icon_info = gtk_icon_theme_lookup_icon (icon_theme, argv[3], size, GTK_ICON_LOOKUP_USE_BUILTIN);
       g_print ("icon for %s at %dx%d is %s\n", argv[3], size, size,
-              icon_info ? gtk_icon_info_get_filename (icon_info) : "<none>");
+              icon_info ? (gtk_icon_info_get_builtin_pixbuf (icon_info) ? "<builtin>" : gtk_icon_info_get_filename (icon_info)) : "<none>");
 
       if (icon_info) 
        {